// 由一个组件，向上找到最近的指定组件
export default function findComponentUpward(context, componentName) {
  let parent = context.$parent;
  let name = parent.$options.name;
  // console.log(context, componentName,parent,name,'111')
  // if (name == componentName) return parent

  while (parent && (!name || [componentName].indexOf(name) < 0)) {
    parent = parent.$parent;
    console.log(parent)
    if (parent) name = parent.$options.name;
    console.log(context, componentName,parent,name)
    // return parent
  }
  return parent;
}
